#ifndef LC_CC0_H_
#define LC_CC0_H_

#include <assert.h>
#include <lagniappe/CommChannel.h>
#include "simpleMutex.h"

#include "memQueue.hh"

class CC0 : public lagniappe::CommChannel, simpleMtx {
private:
	memQueue coreQueue;
	void incCount(const lagniappe::RCon * rcon) {lock(); count++; totalCount++; unlock();}
	void decCount(const lagniappe::RCon * rcon) {lock(); count--; unlock();}
public:
	CC0() : CommChannel(0,0) {}
	virtual ~CC0() {}
	virtual void put(lagniappe::RCon * rcon) {assert(rcon != NULL); assert(&coreQueue != NULL); incCount(rcon); coreQueue.push(rcon);}
	virtual lagniappe::RCon * get() {lagniappe::RCon * rcon = coreQueue.pop(); decCount(rcon); return rcon;}
};
#endif

